#!/usr/bin/env python
# encoding: utf-8
"""
timeTest.py

Created by Brant Faircloth on 2007-10-30.
Copyright (c) 2007 Brant C. Faircloth. All rights reserved.

Script to test the time it takes to create a 500*20 element "array"
and iterate through it.

"""
import numpy,time

def tupleT():
    #import time
    start = time.time()
    # create 500 element list with 20 element subset
    t = ((),)
    t *= 20
    t = (t,)
    t *= 500
    for i in t:
        pass
    end = time.time()
    print 'tuple total=', end - start

def listT():
    #import time
    start = time.time()
    # create 500 element list with 20 element subset
    t = [[]]
    t *= 20
    t = [t,]
    t *= 500
    for i in t:
        pass
    end = time.time()
    print 'list total=', end - start

def arrayT():

    start = time.time()
    t = numpy.zeros((500,20))
    for i in t:
        pass
    end = time.time()
    print 'array total=', end - start
    
def main():
    tupleT()
    listT()
    arrayT()


if __name__ == '__main__':
    main()

